package service.impl;

import bean.Emp;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import mapper.EmpMapper;
import org.springframework.stereotype.Service;
import service.EmpService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {
    @Resource
    private EmpMapper empMapper;
    @Override
    public PageInfo<Emp> findAllEmp(int page) {
        PageHelper.startPage(page,10);
        return new PageInfo<>(empMapper.findAllEmp());
    }

    //删除之后重新查一次，查第一页就好了
    @Override
    public PageInfo<Emp> deleteEmp(int id) {
         empMapper.deleteEmp(id);
         return findAllEmp(1);
    }


}
